<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<script type="text/javascript">
	$(function(){
		loadOrganizationTree();
	});
	function loadOrganizationTree(){
		$("#organization_grid_select").jqGridInit({
			url : "/admin/systemorganization/loadOrganizationTree.do",
			colNames : ['组织名称','状态' , '是否叶子节点', 'ID', '组织层级','上级组织', '组织路径'],
	        colModel : [ 
	                     {name : 'organization_name',index : 'organization_name',editable: true,editrules:{required:true}}, 
	                     {name : 'status',index : 'status',width:35,editable: true,edittype:"select",editoptions:{value:"0:有效;1:无效"}},
	                     {name : "is_leaf",index : "is_leaf",hidden:true,edittype:"select",editoptions:{value:"true:是;false:否"},editrules:{edithidden:true}},
	                     
	                     {name : 'organization_id',index : 'organization_id',hidden:true,key:true}, 
	                     
	                     {name : 'level',index : 'level',hidden:true},
	                     {name : 'parent_id',index : 'parent_id',hidden:true}, 
	                     {name : 'path',index : 'path',hidden:true}
	                   ],
	        //caption : "组织结构",
	        editurl: "/admin/systemorganization/edit.do",//编辑保存后台的值
	        autowidth:true,
	        treeGrid: true,  
	        height:300,
	        scrollOffset:1,		//滚动条宽度
   			ExpandColumn:"organization_name",
	        treeReader:{
		    	parent_id_field: "parent_id",	//父ID，与organization_id对应，必须
		    	leaf_field: "is_leaf",			//字段是否有下级节点，如果没有此字段，全部节点都会有展开图标
		    },
		    onSelectRow:function(id){
		    }
		});
		$("#organization_grid_select-pager").hide();
	}
	function returnSelectRow(){
		var id = $("#organization_grid_select").jqGrid("getGridParam","selrow");
		var rowData = $("#organization_grid_select").jqGrid("getRowData",id);
		return rowData; 
	}
</script>
<div class="row">
	<table id="organization_grid_select"></table>
</div>